x86/irq: fix infinite loop in irq_move_cleanup_interrupt
authorRoger Pau Monné <roger.pau@citrix.com>
Tue, 15 Dec 2020 11:30:54 +0000 (12:30 +0100)
committerHans van Kranenburg <hans@knorrie.org>
Tue, 15 Dec 2020 11:30:54 +0000 (12:30 +0100)
commit86432d1537345dcbbf63f27ef230be26ae75b700
treec5e8b5f70b95e3833ebda9da45f3fe44ab9c4053
parentf376a1bed204a74bbb86a3e3e9195a3f08bb55a0
x86/irq: fix infinite loop in irq_move_cleanup_interrupt

If Xen enters irq_move_cleanup_interrupt with a dynamic vector below
IRQ_MOVE_CLEANUP_VECTOR pending in IRR (0x20 or 0x21) that's also
designated for a cleanup it will enter a loop where
irq_move_cleanup_interrupt continuously sends a cleanup IPI (vector
0x22) to itself while waiting for the vector with lower priority to be
injected - which will never happen because IRQ_MOVE_CLEANUP_VECTOR
takes precedence and it's always injected first.

Fix this by making sure vectors below IRQ_MOVE_CLEANUP_VECTOR are
marked as used and thus not available for APs. Also add some logic to
assert and prevent irq_move_cleanup_interrupt from entering such an
infinite loop, albeit that should never happen given the current code.

This is XSA-356 / CVE-2020-29567.

Fixes: 3fba06ba9f8 ('x86/IRQ: re-use legacy vector ranges on APs')
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/irq.c